<?php include("../components/autoload.php"); ?>
<?php include("../components/functions.php"); ?>
<?php include("../../components/connection.php"); ?>

<?php
	@header('Content-Type: text/html; charset=UTF-8'); 
	
	var_dump($_FILES);
	
	$article = new Article(0);
	
	$article->naslov = $_POST['title'];
	$article->tekst = $_POST['text'];
	$article->datum = date("Y-m-d H:i:s", strtotime("NOW"));;
	$article->vazna = $_POST['featured'];
	$article->prioritet = $_POST['importance'];
	
	$article->slika = createImage($_FILES["image"], 620, "../../media/vesti/slike", $article->naslov);
	makeThumb($_FILES["image"], 280, 260, "../../media/vesti/thumbs", $article->slika);
	
	$article->insertIntoDb();	
	
?>